Skip to content

Remove WP Super Cache from the Jetpack monorepo#852

Merged
kraftbj merged 3 commits into
trunkfrom
standalone-dev-HOG-483
Apr 7, 2026
Merged

Remove WP Super Cache from the Jetpack monorepo#852
kraftbj merged 3 commits into
trunkfrom
standalone-dev-HOG-483

Conversation

@kraftbj
Copy link
Copy Markdown
Contributor

@kraftbj kraftbj commented Apr 7, 2026

Fixes HOG-483

Proposed changes

  • Remove projects/plugins/super-cache/ entirely — development is moving to the standalone repo at Automattic/wp-super-cache
  • Remove 34 super-cache entries from tools/phpcs-excludelist.json
  • Remove super-cache skip line from tools/audit-mirror-repos.sh
  • Replace Boost's Phan parse_file_list references to super-cache source files with local stubs (wp_cache_clear_cache, wp_cache_is_enabled)
  • Update pnpm-lock.yaml (workspace entry removed automatically)

Other information

Runtime integrations are intentionally left untouched:

  • projects/plugins/boost/compatibility/wp-super-cache.php — cache bypass for Critical CSS
  • projects/plugins/boost/compatibility/wp-super-cache-migration.php — auto-enable Boost Page Cache for WPSC migrants
  • projects/packages/sync/src/modules/class-wp-super-cache.php — syncs WPSC globals/constants

These all use runtime detection (function_exists, global variable checks) and don't depend on the monorepo project existing.

Related product discussion/links

Does this pull request change what data or activity we track or use?

No.

Testing instructions

  • Verify CI passes (no broken references to the removed project)
  • Verify pnpm install succeeds
  • Confirm Boost's Phan analysis passes with the new stubs
  • Confirm Boost compatibility files and Sync module have no monorepo path dependencies (they don't — purely runtime detection)

Set up testing, linting, static analysis, and CI workflows
for direct development outside the Jetpack monorepo.

- Add tests (PHP unit + E2E), changelog entries, and .w.org-assets from monorepo
- Set up standalone Phan, PHPCS, and ESLint configs
- Add CI workflows for PHP tests, linting, and changelog validation
- Remove committed vendor/ (use composer install instead)
- Update composer.json, package.json, and .gitattributes for standalone use
- Remove mirror-repo extra key from composer.json
- Remove e2e-tests.yml (was dispatching back to monorepo)

See HOG-483
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

Thank you for your interest!

Pull requests should be made against the monorepo at https://github.com/Automattic/jetpack.

@kraftbj kraftbj closed this Apr 7, 2026
@kraftbj kraftbj deleted the standalone-dev-HOG-483 branch April 7, 2026 18:52
@kraftbj kraftbj restored the standalone-dev-HOG-483 branch April 7, 2026 18:52
@kraftbj kraftbj reopened this Apr 7, 2026
@kraftbj kraftbj merged commit 1eeda4d into trunk Apr 7, 2026
1 of 6 checks passed
@kraftbj kraftbj deleted the standalone-dev-HOG-483 branch April 7, 2026 21:22
@kraftbj kraftbj requested a review from Copilot April 7, 2026 21:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes WP Super Cache from the Jetpack monorepo packaging approach and reorients the project toward standalone-repo development by dropping committed Composer autoload artifacts, updating metadata/tooling, and adding local CI/lint/static-analysis plus an e2e Docker/Jest harness.

Changes:

  • Remove committed Composer-generated vendor/ autoload/runtime files and update Composer config/lock accordingly.
  • Add/adjust tooling for standalone development: PHPUnit bootstrap/config, PHPCS ruleset, Phan config/baseline/stubs, ESLint config, GitHub Actions workflows.
  • Add a new Docker-based e2e test project under tests/e2e/ (Jest/TS helpers, specs, compose/Dockerfile, MU helper plugin).

Reviewed changes

Copilot reviewed 63 out of 81 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
vendor/composer/LICENSE Remove committed Composer license file.
vendor/composer/InstalledVersions.php Remove committed Composer runtime file.
vendor/composer/installed.php Remove committed Composer-installed metadata.
vendor/composer/installed.json Remove committed Composer-installed metadata JSON.
vendor/composer/ClassLoader.php Remove committed Composer autoloader implementation.
vendor/composer/autoload_static.php Remove committed Composer-generated static autoload map.
vendor/composer/autoload_real.php Remove committed Composer-generated autoloader init.
vendor/composer/autoload_psr4.php Remove committed Composer-generated PSR-4 map.
vendor/composer/autoload_namespaces.php Remove committed Composer-generated namespaces map.
vendor/composer/autoload_classmap.php Remove committed Composer-generated classmap.
vendor/autoload.php Remove committed Composer autoloader entrypoint.
tests/php/bootstrap.php Add PHPUnit bootstrap loading Composer autoloader.
phpunit.9.xml.dist Add PHPUnit 9 config pointing to new bootstrap.
tests/e2e/tsconfig.json Add TS config for e2e project.
tests/e2e/package.json Add e2e package (Jest/TS deps + scripts).
tests/e2e/jest.config.js Add Jest config for e2e tests (dotenv load).
tests/e2e/eslint.config.mjs Add ESLint config for e2e project.
tests/e2e/Dockerfile Add WordPress-based image for e2e environment.
tests/e2e/docker-compose.yml Add compose stack for DB + WP + plugin mount.
tests/e2e/.env Add local env defaults for e2e stack.
tests/e2e/tools/mu-test-helpers.php Add MU helper for e2e auth/footer markers.
tests/e2e/tools/htaccess.txt Add baseline WordPress .htaccess used by tests.
tests/e2e/tools/apache2-wrapper.sh Add entry wrapper to install WP + start Apache.
tests/e2e/lib/system-tools.ts Add local shell exec helper used by Docker tooling.
tests/e2e/lib/docker-tools.ts Add Docker exec/file helpers for e2e tests.
tests/e2e/lib/wordpress-tools.ts Add wp-cli helpers + env reset helper.
tests/e2e/lib/test-tools.ts Add HTTP page-load helper used in specs.
tests/e2e/lib/plugin-tools.ts Add plugin/e2e helpers (auth cookie, cache ops, URLs).
tests/e2e/lib/plugin-settings.ts Add settings form automation helpers for e2e.
tests/e2e/lib/CheerioForm.ts Add Cheerio-based HTML form manipulation helper.
tests/e2e/specs/activation.test.ts Add activation e2e coverage.
tests/e2e/specs/default-settings.test.ts Add default caching behavior e2e coverage.
tests/e2e/specs/settings/mod-rewrite.test.ts Add mod_rewrite e2e coverage.
tests/e2e/specs/settings/cache-compression.test.ts Add compression e2e coverage.
tests/e2e/specs/settings/no-cache-for-get.test.ts Add “no cache for GET” e2e coverage.
tests/e2e/specs/settings/not-logged-in.test.ts Add “not logged in” caching e2e coverage.
package.json Update repo metadata for standalone issues/repo; add eslint deps.
eslint.config.mjs Add root ESLint configuration.
composer.json Add dev tools (Phan, stubs, Jetpack codesniffer) and allow-plugin config.
composer.lock Update lockfile consistent with Composer/tooling changes.
.phpcs.xml.dist Add PHPCS ruleset for the project.
.phan/config.php Add Phan configuration.
.phan/baseline.php Add Phan baseline suppressions.
.phan/stubs/amp-stubs.php Add AMP stubs used for static analysis.
.gitignore Add ignores for vendor/ and node_modules/.
.eslintignore Add eslint ignore list for known-problem files.
.github/workflows/php-tests.yml Add PHPUnit workflow matrix.
.github/workflows/linting.yml Add PHPCS workflow.
.github/workflows/e2e-tests.yml Remove old workflow that dispatched e2e tests to Jetpack monorepo.
.github/workflows/changelogger.yml Add changelogger validation workflow.
.gitattributes Update export-ignore rules for release zip contents.
changelog/update-tsgo-fix-type-errors-in-e2e-projects Add changelog entry (tsgo type errors fix).
changelog/update-tooling-update_stable_tag_in_backport Add changelog entry (stable tag update).
changelog/update-switch-to-tsgo Add changelog entry (switch to tsgo).
changelog/update-node-24 Add changelog entry (Node typings bump).
changelog/update-minimum-wp-to-6.8 Add changelog entry (min WP bump).
changelog/update-gpl-license-address Add changelog entry (GPL notice update).
changelog/update-composer-2.9 Add changelog entry (Composer 2.9 lock update).
changelog/renovate-wikimedia-testing-access-wrapper-4.x Add changelog entry (lock update).
changelog/renovate-npm-axios-vulnerability Add changelog entry (deps update).
changelog/renovate-major-definitelytyped Add changelog entry (deps update).
changelog/renovate-lock-file-maintenance#3 Add changelog entry (deps update).
changelog/renovate-lock-file-maintenance#2 Add changelog entry (deps update).
changelog/renovate-lock-file-maintenance Add changelog entry (deps update).
changelog/renovate-js-unit-testing-packages#2 Add changelog entry (deps update).
changelog/renovate-js-unit-testing-packages Add changelog entry (deps update).
changelog/renovate-cheerio-1.x Add changelog entry (deps update).
changelog/remove-wpsc-outside-dep-device-detection Add changelog entry (device detection dependency change).
changelog/fix-phpcompatibility-dev-run Add changelog entry (phpcompatibility suppression fix).
changelog/fix-null-wp-cache-home-path Add changelog entry (PHP 8.1 deprecation fix).
changelog/fix-more-json-encode-flags Add changelog entry (json_encode flags).
changelog/fix-audit_json_encode_flags_part_trois Add changelog entry (json_encode flags).
changelog/add-live-preview-blueprint Add changelog entry (blueprint added).
changelog/add-check-type-for-supercache-last-cached-option Add changelog entry (warning fix).
changelog/.gitkeep Keep changelog directory tracked.
.w.org-assets/README.md Add w.org assets directory README.
.w.org-assets/icon-256x256.png Add plugin icon asset.
.w.org-assets/icon-128x128.png Add plugin icon asset.
.w.org-assets/blueprints/blueprint.json Add WordPress.org Live Preview blueprint.
.w.org-assets/banner-772x250.png Add plugin banner asset.
.w.org-assets/banner-1544x500.png Add plugin banner asset.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/e2e/jest.config.js
Comment on lines +4 to +6
// Read .env file so variables are available in tests.
dotenvConfig( { path: fileURLToPath( '.env', import.meta.url ) } );

Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fileURLToPath() only accepts a file URL (or URL object). Passing the string '.env' will throw ERR_INVALID_URL, so Jest config loading will fail before any tests run. Use fileURLToPath( new URL( '.env', import.meta.url ) ) (or resolve via path + process.cwd()).

Copilot uses AI. Check for mistakes.
Comment on lines +12 to +16
'-q',
'--filter',
'ancestor=super-cache-e2e-wordpress '
);
containerId = stdout.trim();
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ancestor= filters include a trailing space (e.g. 'ancestor=super-cache-e2e-wordpress '). This will prevent docker ps from matching the image name and make container discovery fail. Remove the trailing whitespace from both filter strings.

Copilot uses AI. Check for mistakes.
Comment on lines +50 to +54
private element( name: string ): Cheerio< AnyNode > {
const element = this.form.find( `input[name=${ name }]` );
if ( ! element ) {
throw new Error( `Could not find element with name ${ name }` );
}
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CheerioForm.element() checks if ( ! element ), but this.form.find() always returns a Cheerio object (truthy) even when empty, so this never throws. This can mask missing inputs and lead to silently submitting incomplete forms. Check element.length === 0 instead (and consider quoting the attribute selector to handle special characters in name).

Copilot uses AI. Check for mistakes.
Comment thread tests/e2e/package.json
Comment on lines +24 to +28
"jest": "^30.0.0",
"jest-util": "^30.0.0",
"shell-escape": "0.2.0",
"ts-jest": "29.4.6",
"typescript": "5.9.3"
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jest is pinned to ^30.0.0 but ts-jest is 29.4.6. ts-jest major versions track Jest major versions, so this combination is likely incompatible and can break test transforms. Align versions (upgrade ts-jest to a Jest 30-compatible release, or pin Jest back to 29).

Copilot uses AI. Check for mistakes.
Comment thread tests/e2e/Dockerfile
Comment on lines +1 to +2
FROM wordpress:latest

Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using wordpress:latest makes the e2e environment non-reproducible and can introduce breaking changes into CI unexpectedly when the upstream image updates. Pin to a specific WordPress/PHP tag (and ideally a digest) to keep tests stable.

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +4
db:
image: mariadb:latest
healthcheck:
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using mariadb:latest can cause nondeterministic failures as the image updates over time (e.g., auth defaults, SQL modes, collation changes). Pin the MariaDB major/minor version (and ideally a digest) for reproducible e2e runs.

Copilot uses AI. Check for mistakes.
Comment on lines +20 to +24
/**
* Reset the environment; clear out files created by wp-super-cache, and deactivate the plugin.
*/
export async function resetEnvironmnt() {
await wpcli( 'plugin', 'deactivate', 'wp-super-cache', '--skip-themes' );
Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function name appears to have a typo (resetEnvironmnt). This makes call sites harder to read/search and increases the chance of inconsistent naming. Consider renaming to resetEnvironment and updating imports/usages across the e2e tests.

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +46
export async function getAuthCookie(): Promise< string > {
const user = process.env.SUPER_CACHE_E2E_ADMIN_USER;
const pass = process.env.SUPER_CACHE_E2E_ADMIN_PASSWORD;
const encodedAuth = Buffer.from( user + ':' + pass ).toString( 'base64' );
const headers = { Authorization: 'test ' + encodedAuth };

Copy link

Copilot AI Apr 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAuthCookie() uses SUPER_CACHE_E2E_ADMIN_USER/SUPER_CACHE_E2E_ADMIN_PASSWORD without validating they’re set. If either env var is missing, the request will be made with undefined:undefined, leading to confusing failures. Add an explicit check and throw a clear error when required env vars are absent.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants